from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from .libs.captcha.captcha import captcha
from django_redis import get_redis_connection
# Create your views here.

class ImageCodeView(View):
    """
    图形验证码
    """
    def get(self, request, uuid):

        text, image = captcha.generate_captcha()

        redis_conn = get_redis_connection('verify_code')
        redis_conn.setex('img_%s' %uuid, 300, text)
        return HttpResponse(image, content_type='image/jpg')

# class SMSCodeView(View):
#     """
#     短信验证码
#     """
